import java.util.Arrays;

public class Test {

    //数组引用  数组拷贝

    public static void main1(String[] args) {   //数组引用
        int[] arr1={1,2,3,4};
        int[] arr2={11,22,33,44};
        arr2[0]=99;
        arr1=arr2;
        System.out.println(Arrays.toString(arr1));
        System.out.println(Arrays.toString(arr2));
    }

    public static void main2(String[] args) {//数组引用
        int[] arr1={1,2,3,4};
        int[] arr2={11,22,33,44};
        arr1[0]=99;
        arr1=arr2;
        arr2[0]=100;
        System.out.println(Arrays.toString(arr1));
        System.out.println(Arrays.toString(arr2));
    }



    public static void main3(String[] args) {  //数组引用
        int[] array={1,2,3,4,5,6};//0x11
        int[] ret=grow(array);
        System.out.println(Arrays.toString(array));
        System.out.println(Arrays.toString(ret));
    }
    public static int[] grow(int[] array) {
        for(int i=0;i<array.length;i++)
        {
            array[i]=array[i]*2;
        }
        return array;
    }


    public static void main4(String[] args) {  //数组引用
        int[] arr={1,2,3,4};
        System.out.println(Arrays.toString(arr));
        int[] arr1=arr;
        System.out.println(Arrays.toString(arr1));
        int[] arr2=new int[arr.length];

    }


    public static void main(String[] args) {//数组拷贝
        int[] array={1,2,3,4};
        int[] ret=Arrays.copyOf(array,array.length);
        System.out.println(Arrays.toString(ret));
    }
}
